package com.kaibes.core.base.thread;

public interface LoopThread extends RunThread {
    long getInterval();
    
    default void run() {
        setRunning();
        while(isRunning()) {
            doWork();
            if (getInterval() > 0) {
                try {
                    Thread.sleep(getInterval());
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
